package midlet;

import gui.FrmLogin;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.midlet.*;

/**
 * @author Dikas
 */
public class MidletCielsa extends MIDlet{

    private Display objDisplay;
    private FrmLogin frmLogin;    
    

    public MidletCielsa() {
        frmLogin = new FrmLogin(this);
        objDisplay = Display.getDisplay(this);
    }

    public void startApp() {
        setDisplay(frmLogin);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
        objDisplay = null;
    }

    public Display getDisplay() {
        return objDisplay;
    }

    public void setDisplay(Displayable objDisplayable) {
        getDisplay().setCurrent(objDisplayable);
    }

    public void setDisplay(Alert objAlerta, Displayable parent) {
        getDisplay().setCurrent(objAlerta, parent);
    }

    public Displayable getCurrentDisplay() {
        return objDisplay.getCurrent();
    }

    public void shutdown(boolean b) {
        destroyApp(b);
        notifyDestroyed();
    }

    public void showInfo(String string, Displayable currentDisplay) {
        Alert a = new Alert("Alerta", string, null, AlertType.ALARM);
        a.setTimeout(Alert.FOREVER);
        setDisplay(a, currentDisplay);
    }
    
}
